package com.fruit.service.order.impl;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.fruit.pojo.order.MailOrderSummary;
import com.fruit.service.order.MailOrderHandel;
import com.fruit.util.ResultInfo;

import lombok.extern.slf4j.Slf4j;

/**
 * 
 * 寄回订单业务逻辑类
 *
 * @author shibeilei
 * @version 2018.01.02 17:01
 *
 */
@Slf4j
@Service
public class MailOrderHandelNothing implements MailOrderHandel {

	@Autowired
	private MailOrderService mailOrderService;

	@Override
	public Map<String, Object> saveMailLogisticsOrder(String tradeId, Map<String, Object> params) {
		Map<String, Object> resMap = new HashMap<>();
		resMap = mailOrderService.saveMailLogisticsOrder(tradeId, params);
		ResultInfo ri = (ResultInfo) resMap.get("result");
		if ("logistics_error".equals(ri.getCode())) {
			MailOrderSummary mos = (MailOrderSummary) resMap.get("mos");
			mailOrderService.newHandelMailOrderError(mos);
		}
		return resMap;
	}

}
